import java.util.ArrayList;

public class Program {

	public static void main(String[] args) {
		Studentsreader sr = new Studentsreader();
		
		Classroom classroom = null;
		
		try {
			classroom = sr.read("students.csv");
		} catch(IllegalCSVStructureException e) {
			System.out.println(e.getMessage());
			System.exit(-1);
		}
		
		// nice prints
		System.out.println("current classroom (as read by Studentsreader)\n");
		System.out.println(classroom.toCSVString());
		
		// start writin our nifty lil xml
		Nodeswriter nw = new Nodeswriter();
		nw.write("students.xml", classroom);
		
		// start readin our nifty lil xml
		Nodesreader nr = new Nodesreader();
		Classroom output = nr.read("students.xml");
		
		// some more nice prints
		System.out.println("output classroom (as read by Nodesreader)\n");
		System.out.println(output.toCSVString());
		
		// and convert once again (for testing purposes)
		nw.write("students2.xml", output);
		
		// interestingly, for my piece of testdata, reading the output file and writing it again
		// rearranges the order of the optional subjects
		// their values remain correct though
	}

}
